package com.fw.ui.view.profile.service.event;

import static org.springframework.beans.factory.config.BeanDefinition.SCOPE_PROTOTYPE;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import org.vaadin.dialogs.ConfirmDialog;

import com.fw.service.bean.EntryBean;
import com.fw.service.bean.ErrorBean;
import com.fw.service.serviceprofile.bean.ServiceProfileBean;
import com.fw.ui.ApplicationUI;
import com.fw.ui.bao.FileBAO;
import com.fw.ui.bao.MasterDataBAO;
import com.fw.ui.bao.MessageBAO;
import com.fw.ui.bao.PropertyBAO;
import com.fw.ui.bao.ServiceProfileBAO;
import com.fw.ui.bean.merchantprofile.EditMerchantProfileTableItemBean;
import com.fw.ui.util.SessionInfoUtils;
import com.fw.ui.util.UICommonUtils;
import com.fw.ui.util.VaadinApplicationObjectSupport;
import com.fw.ui.view.common.ConfirmDialogWindow;
import com.fw.ui.view.common.TablePanel;
import com.fw.ui.view.common.util.TableHeaderProperty;
import com.fw.ui.view.event.AbstractButtonClickListener;
import com.fw.ui.view.profile.EditCashServiceProfileView;
import com.fw.util.DataUtils;
import com.fw.util.StringUtils;
import com.vaadin.data.util.BeanItem;
import com.vaadin.server.Sizeable.Unit;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Table.Align;

@Component
@Scope(SCOPE_PROTOTYPE)
public class EditCashServiceProfileSaveButtonClickListener extends AbstractButtonClickListener {

    // private static Logger log = Logger.getLogger(EditCashServiceProfileSaveButtonClickListener.class.getName());
    private static final long serialVersionUID = 1L;

    @Autowired
    protected transient VaadinApplicationObjectSupport app;
    @Autowired
    private ServiceProfileBAO serviceProfileBAO;
    @Autowired
    private MasterDataBAO masterDataBAO;
    @Autowired
    private MessageBAO messageBAO;
    @Autowired
    private PropertyBAO propertyBAO;
    @Autowired
    private UICommonUtils uiCommonUtils;
    @Autowired
    private FileBAO fileBAO;
    @Autowired
    private SessionInfoUtils sessionInfoUtils;

    @Autowired
    protected TablePanel tablePanel;
    private TableHeaderProperty hLabel = new TableHeaderProperty();
    private TableHeaderProperty hOldValue = new TableHeaderProperty();
    private TableHeaderProperty hNewValue = new TableHeaderProperty();

    @SuppressWarnings({ "unchecked", "rawtypes" })
    @Override
    public Map<String, Object> click(ClickEvent event) throws Exception {

	final Map<String, Object> result = new HashMap<String, Object>();
	final EditCashServiceProfileView editCashServiceProfileView = (EditCashServiceProfileView) this.getBasedComponent();

	String title = messageBAO.getMessage("com.fw.ui.view.profile.EditCashServiceProfileView.message.confirm.title");
	String okCaption = messageBAO.getMessage("application.button.ok.caption");
	String cancelCaption = messageBAO.getMessage("application.button.cancel.caption");

	Boolean isTestService = editCashServiceProfileView.getCbIsTestService().getValue();
	String host = (String) editCashServiceProfileView.getCbbHost().getValue();
	String serviceStatus = (String) editCashServiceProfileView.getCbbServiceStatus().getValue();
	Boolean isBankGuarantee = editCashServiceProfileView.getCbIsBankGuarantee().getValue();
	String bankGuarantee = editCashServiceProfileView.getTxtBankGuarantee().getValue();
	Date bankGuaranteeExpireDate = editCashServiceProfileView.getPdfBankGuaranteeExpireDate().getValue();
	String bankGuaranteeExpireDateStr = null;
	if (bankGuaranteeExpireDate != null) {
	    bankGuaranteeExpireDateStr = StringUtils.formatDate(bankGuaranteeExpireDate, StringUtils.PATTERN_MONTH_YEAR_PERSISTENCE);
	}
	String chequeName = editCashServiceProfileView.getTxtChequeName().getValue();
	Date launchedDate = editCashServiceProfileView.getPdfLaunchedDate().getValue();
	String launchedDateStr = null;
	if (launchedDate != null) {
	    launchedDateStr = StringUtils.formatDate(launchedDate, StringUtils.PATTERN_DATE_PERSISTENCE);
	}
	Boolean isNotifyCustomer = editCashServiceProfileView.getCbIsNotifyCustomer().getValue();
	Boolean isResponseUrlBack = editCashServiceProfileView.getCbIsResponseUrlBack().getValue();
	String responseUrlBack = editCashServiceProfileView.getTxtResponseUrlBack().getValue();
	Boolean isSuccessUrl = editCashServiceProfileView.getCbIsSuccessUrl().getValue();
	String successUrl = editCashServiceProfileView.getTxtSuccessUrl().getValue();
	Boolean isFailUrl = editCashServiceProfileView.getCbIsFailUrl().getValue();
	String failUrl = editCashServiceProfileView.getTxtFailUrl().getValue();
	Boolean isCancelUrl = editCashServiceProfileView.getCbIsCancelUrl().getValue();
	String cancelUrl = editCashServiceProfileView.getTxtCancelUrl().getValue();

	String invoiceAging = editCashServiceProfileView.getTxtInvoiceAging().getValue();
	Boolean isBypassInvoiceAging = editCashServiceProfileView.getCbIsBypassInvoiceAging().getValue();
	String bankCodeAndName = (String) editCashServiceProfileView.getCbbBankCodeAndName().getValue();
	String bankAccountNo = editCashServiceProfileView.getTxtBankAccountNo().getValue();
	String sapArCode = editCashServiceProfileView.getTxtSapArCode().getValue();
	String sapApCode = editCashServiceProfileView.getTxtSapApCode().getValue();
	String messageSlip1 = editCashServiceProfileView.getTxtMessageSlip1().getValue();
	String messageSlip2 = editCashServiceProfileView.getTxtMessageSlip2().getValue();
	String mdr = editCashServiceProfileView.getTxtMdr().getValue();
	String serviceFee = editCashServiceProfileView.getTxtServiceFee().getValue();

	String dailyLimit = editCashServiceProfileView.getTxtDailyLimit().getValue();
	String monthlyLimit = editCashServiceProfileView.getTxtMonthlyLimit().getValue();
	String transactionAmountLimit = editCashServiceProfileView.getTxtTransactionAmountLimit().getValue();

	String contact1Name = editCashServiceProfileView.getTxtProjectContactName().getValue();
	String contact1Mobile = editCashServiceProfileView.getTxtProjectContactMobile().getValue();
	String contact1Email = editCashServiceProfileView.getTxtProjectContactEmailAddress().getValue();
	String contact1Phone = editCashServiceProfileView.getTxtProjectContactPhone().getValue();

	String contact2Name = editCashServiceProfileView.getTxtOperationContactName().getValue();
	String contact2Mobile = editCashServiceProfileView.getTxtOperationContactMobile().getValue();
	String contact2Email = editCashServiceProfileView.getTxtOperationContactEmailAddress().getValue();
	String contact2Phone = editCashServiceProfileView.getTxtOperationContactPhone().getValue();

	String contact3Name = editCashServiceProfileView.getTxtTechnicalContactName().getValue();
	String contact3Mobile = editCashServiceProfileView.getTxtTechnicalContactMobile().getValue();
	String contact3Email = editCashServiceProfileView.getTxtTechnicalContactEmailAddress().getValue();
	String contact3Phone = editCashServiceProfileView.getTxtTechnicalContactPhone().getValue();

	String contact4Name = editCashServiceProfileView.getTxtFinancialContactName().getValue();
	String contact4Mobile = editCashServiceProfileView.getTxtFinancialContactMobile().getValue();
	String contact4Email = editCashServiceProfileView.getTxtFinancialContactEmailAddress().getValue();
	String contact4Phone = editCashServiceProfileView.getTxtFinancialContactPhone().getValue();

	final ServiceProfileBean oldServiceProfileBean = editCashServiceProfileView.getServiceProfileBean();
	final ServiceProfileBean serviceProfileBean = new ServiceProfileBean();
	BeanUtils.copyProperties(oldServiceProfileBean, serviceProfileBean);

	serviceProfileBean.setServiceStatus(serviceStatus);
	serviceProfileBean.setHost(host);
	serviceProfileBean.setIsBankGuarantee(isBankGuarantee);
	serviceProfileBean.setBankGuarantee(bankGuarantee);
	serviceProfileBean.setBankGuaranteeExpireDate(bankGuaranteeExpireDateStr);
	serviceProfileBean.setChequeName(chequeName);
	serviceProfileBean.setLaunchedDate(launchedDateStr);
	serviceProfileBean.setIsResponseUrlBack(isResponseUrlBack);
	serviceProfileBean.setResponseUrlBack(responseUrlBack);
	serviceProfileBean.setIsSuccessUrl(isSuccessUrl);
	serviceProfileBean.setSuccessUrl(successUrl);
	serviceProfileBean.setIsFailUrl(isFailUrl);
	serviceProfileBean.setFailUrl(failUrl);
	serviceProfileBean.setIsCancelUrl(isCancelUrl);
	serviceProfileBean.setCancelUrl(cancelUrl);
	serviceProfileBean.setIsNotifyCustomer(isNotifyCustomer);
	serviceProfileBean.setIsTestService(isTestService);
	serviceProfileBean.setInvoiceAging(invoiceAging);
	serviceProfileBean.setIsBypassInvoiceAging(isBypassInvoiceAging);
	serviceProfileBean.setBankCodeAndName(bankCodeAndName);
	serviceProfileBean.setBankAccountNo(bankAccountNo);
	serviceProfileBean.setSapArCode(sapArCode);
	serviceProfileBean.setSapApCode(sapApCode);
	serviceProfileBean.setMessageSlip1(messageSlip1);
	serviceProfileBean.setMessageSlip2(messageSlip2);
	serviceProfileBean.setMdr(mdr);
	serviceProfileBean.setServiceFee(serviceFee);
	serviceProfileBean.setDailyLimit(dailyLimit);
	serviceProfileBean.setMonthlyLimit(monthlyLimit);
	serviceProfileBean.setTransactionAmountLimit(transactionAmountLimit);

	serviceProfileBean.setContact1Name(contact1Name);
	serviceProfileBean.setContact1Mobile(contact1Mobile);
	serviceProfileBean.setContact1Email(contact1Email);
	serviceProfileBean.setContact1Phone(contact1Phone);

	serviceProfileBean.setContact2Name(contact2Name);
	serviceProfileBean.setContact2Mobile(contact2Mobile);
	serviceProfileBean.setContact2Email(contact2Email);
	serviceProfileBean.setContact2Phone(contact2Phone);

	serviceProfileBean.setContact3Name(contact3Name);
	serviceProfileBean.setContact3Mobile(contact3Mobile);
	serviceProfileBean.setContact3Email(contact3Email);
	serviceProfileBean.setContact3Phone(contact3Phone);

	serviceProfileBean.setContact4Name(contact4Name);
	serviceProfileBean.setContact4Mobile(contact4Mobile);
	serviceProfileBean.setContact4Email(contact4Email);
	serviceProfileBean.setContact4Phone(contact4Phone);

	this.tablePanel.init();
	// set table
	this.hLabel.setColumnName(this.messageBAO.getMessage("com.fw.ui.view.profile.EditCashServiceProfileView.header.label"));
	this.hOldValue.setColumnName(this.messageBAO.getMessage("com.fw.ui.view.profile.EditCashServiceProfileView.header.oldValue"));
	this.hNewValue.setColumnName(this.messageBAO.getMessage("com.fw.ui.view.profile.EditCashServiceProfileView.header.newValue"));

	this.hLabel.setColumnId("label");
	this.hLabel.setType(String.class);
	this.hLabel.setAlignment(Align.LEFT);
	this.hLabel.setDefaultValue(null);
	this.hLabel.setIconResource(null);
	this.hLabel.setOrder(1);

	this.hOldValue.setColumnId("oldValue");
	this.hOldValue.setType(String.class);
	this.hOldValue.setAlignment(Align.CENTER);
	this.hOldValue.setDefaultValue(null);
	this.hOldValue.setIconResource(null);
	this.hOldValue.setOrder(2);

	this.hNewValue.setColumnId("newValue");
	this.hNewValue.setType(String.class);
	this.hNewValue.setAlignment(Align.CENTER);
	this.hNewValue.setDefaultValue(null);
	this.hNewValue.setIconResource(null);
	this.hNewValue.setOrder(3);

	List<TableHeaderProperty> headerProperties = new ArrayList<TableHeaderProperty>();
	headerProperties.add(hLabel);
	headerProperties.add(hOldValue);
	headerProperties.add(hNewValue);

	this.tablePanel.setTableColumnHeader(this.hLabel.getColumnId(), this.hLabel.getColumnName());
	this.tablePanel.setTableColumnHeader(this.hOldValue.getColumnId(), this.hOldValue.getColumnName());
	this.tablePanel.setTableColumnHeader(this.hNewValue.getColumnId(), this.hNewValue.getColumnName());

	this.tablePanel.setTableBeanContainerColumnHeader(headerProperties, EditMerchantProfileTableItemBean.class);
	this.tablePanel.setTableSelect(false);
	this.tablePanel.setAllowSortRecord(false);
	this.tablePanel.setEnableTableSorting(false);
	this.tablePanel.setTableColumnReordering(false);
	// this.tablePanel.createControlTablePageNumber();

	List<BeanItem> beanItems = this.generateTableItemBean(oldServiceProfileBean, serviceProfileBean);
	this.tablePanel.clearTableData();
	// this.tablePanel.setManualPageTable(1);
	this.tablePanel.setTableBeanContainerData(beanItems);

	tablePanel.setWidth(100, Unit.PERCENTAGE);
	tablePanel.setHeight(155, Unit.PIXELS);

	ConfirmDialogWindow.createConfirmDialog(editCashServiceProfileView.getUI(), title, this.tablePanel, okCaption, cancelCaption,
		new ConfirmDialog.Listener() {
		    private static final long serialVersionUID = 1L;

		    @Override
		    public void onClose(ConfirmDialog dialog) {
			if (dialog.isConfirmed()) {

			    try {

				ApplicationUI applicationUI = (ApplicationUI) editCashServiceProfileView.getUI();
				sessionInfoUtils.setSessionInfoDetails(serviceProfileBean, applicationUI.getAuthenticationBean(),
					applicationUI.getLocale());

				Map<String, Serializable> mapResult = serviceProfileBAO.updateServiceProfile(serviceProfileBean);
				if (mapResult != null) {
				    List<ErrorBean> errorBeans = (List<ErrorBean>) mapResult.get(List.class.getName() + "."
					    + ErrorBean.class.getName());
				    ServiceProfileBean resultServiceProfileBean = (ServiceProfileBean) mapResult
					    .get(ServiceProfileBean.class.getName());
				    if (errorBeans != null && !errorBeans.isEmpty()) {
					result.put(MessageBAO.MESSAGE_WARNING_TYPE, errorBeans);
				    } else {
					if (resultServiceProfileBean != null && resultServiceProfileBean.getId() != null) {
					    editCashServiceProfileView.setServiceProfileBean(resultServiceProfileBean);

					    List<EntryBean<String, String>> masterData = masterDataBAO
						    .selectServiceProfileStatusByCurrentStatus(resultServiceProfileBean.getServiceStatus());
					    if (masterData != null && !masterData.isEmpty()) {
						editCashServiceProfileView.getCbbServiceStatus().removeAllItems();
						for (EntryBean<String, String> entry : masterData) {
						    editCashServiceProfileView.getCbbServiceStatus().addItem(entry.getKey());
						    editCashServiceProfileView.getCbbServiceStatus().setItemCaption(entry.getKey(),
							    entry.getValue());
						}
					    }

					    uiCommonUtils.setValueUIComponent(editCashServiceProfileView.getCbIsTestService(),
						    resultServiceProfileBean.getIsTestService());
					    uiCommonUtils.setValueUIComponent(editCashServiceProfileView.getTxtServiceId(),
						    resultServiceProfileBean.getServiceId());
					    uiCommonUtils.setValueUIComponent(editCashServiceProfileView.getCbbMerchantId(),
						    resultServiceProfileBean.getMerchantId());
					    uiCommonUtils.setValueUIComponent(editCashServiceProfileView.getCbbServiceStatus(),
						    resultServiceProfileBean.getServiceStatus());
					    uiCommonUtils.setValueUIComponent(editCashServiceProfileView.getCbbHost(),
						    resultServiceProfileBean.getHost());
					    uiCommonUtils.setValueUIComponent(editCashServiceProfileView.getCbIsBankGuarantee(),
						    resultServiceProfileBean.getIsBankGuarantee());
					    uiCommonUtils.setValueUIComponent(editCashServiceProfileView.getTxtBankGuarantee(),
						    resultServiceProfileBean.getBankGuarantee());
					    if (resultServiceProfileBean.getBankGuaranteeExpireDate() != null
						    && !resultServiceProfileBean.getBankGuaranteeExpireDate().isEmpty()) {
						uiCommonUtils.setValueUIComponent(editCashServiceProfileView
							.getPdfBankGuaranteeExpireDate(), StringUtils.parseDate(
							resultServiceProfileBean.getBankGuaranteeExpireDate(),
							StringUtils.PATTERN_MONTH_YEAR_PERSISTENCE));
					    } else {
						uiCommonUtils.setValueUIComponent(
							editCashServiceProfileView.getPdfBankGuaranteeExpireDate(), null);
					    }
					    uiCommonUtils.setValueUIComponent(editCashServiceProfileView.getTxtChequeName(),
						    resultServiceProfileBean.getChequeName());
					    if (resultServiceProfileBean.getLaunchedDate() != null
						    && !resultServiceProfileBean.getLaunchedDate().isEmpty()) {
						uiCommonUtils.setValueUIComponent(editCashServiceProfileView.getPdfLaunchedDate(),
							StringUtils.parseDate(resultServiceProfileBean.getLaunchedDate(),
								StringUtils.PATTERN_DATE_PERSISTENCE));
					    } else {
						uiCommonUtils.setValueUIComponent(editCashServiceProfileView.getPdfLaunchedDate(), null);
					    }
					    uiCommonUtils.setValueUIComponent(editCashServiceProfileView.getCbIsResponseUrlBack(),
						    resultServiceProfileBean.getIsResponseUrlBack());
					    uiCommonUtils.setValueUIComponent(editCashServiceProfileView.getTxtResponseUrlBack(),
						    resultServiceProfileBean.getResponseUrlBack());
					    uiCommonUtils.setValueUIComponent(editCashServiceProfileView.getCbIsSuccessUrl(),
						    resultServiceProfileBean.getIsSuccessUrl());
					    uiCommonUtils.setValueUIComponent(editCashServiceProfileView.getTxtSuccessUrl(),
						    resultServiceProfileBean.getSuccessUrl());
					    uiCommonUtils.setValueUIComponent(editCashServiceProfileView.getCbIsNotifyCustomer(),
						    resultServiceProfileBean.getIsNotifyCustomer());
					    uiCommonUtils.setValueUIComponent(editCashServiceProfileView.getCbIsFailUrl(),
						    resultServiceProfileBean.getIsFailUrl());
					    uiCommonUtils.setValueUIComponent(editCashServiceProfileView.getTxtFailUrl(),
						    resultServiceProfileBean.getFailUrl());
					    uiCommonUtils.setValueUIComponent(editCashServiceProfileView.getCbIsCancelUrl(),
						    resultServiceProfileBean.getIsCancelUrl());
					    uiCommonUtils.setValueUIComponent(editCashServiceProfileView.getTxtCancelUrl(),
						    resultServiceProfileBean.getCancelUrl());

					    uiCommonUtils.setValueUIComponent(editCashServiceProfileView.getTxtInvoiceAging(),
						    resultServiceProfileBean.getInvoiceAging());
					    uiCommonUtils.setValueUIComponent(editCashServiceProfileView.getCbIsBypassInvoiceAging(),
						    resultServiceProfileBean.getIsBypassInvoiceAging());
					    uiCommonUtils.setValueUIComponent(editCashServiceProfileView.getCbbBankCodeAndName(),
						    resultServiceProfileBean.getBankCodeAndName());
					    uiCommonUtils.setValueUIComponent(editCashServiceProfileView.getTxtBankAccountNo(),
						    resultServiceProfileBean.getBankAccountNo());
					    uiCommonUtils.setValueUIComponent(editCashServiceProfileView.getTxtSapApCode(),
						    resultServiceProfileBean.getSapApCode());
					    uiCommonUtils.setValueUIComponent(editCashServiceProfileView.getTxtSapArCode(),
						    resultServiceProfileBean.getSapArCode());
					    uiCommonUtils.setValueUIComponent(editCashServiceProfileView.getTxtMessageSlip1(),
						    resultServiceProfileBean.getMessageSlip1());
					    uiCommonUtils.setValueUIComponent(editCashServiceProfileView.getTxtMessageSlip2(),
						    resultServiceProfileBean.getMessageSlip2());
					    uiCommonUtils.setValueUIComponent(editCashServiceProfileView.getTxtMdr(),
						    resultServiceProfileBean.getMdr());
					    uiCommonUtils.setValueUIComponent(editCashServiceProfileView.getTxtServiceFee(),
						    resultServiceProfileBean.getServiceFee());

					    uiCommonUtils.setValueUIComponent(editCashServiceProfileView.getTxtDailyLimit(),
						    resultServiceProfileBean.getDailyLimit());
					    uiCommonUtils.setValueUIComponent(editCashServiceProfileView.getTxtMonthlyLimit(),
						    resultServiceProfileBean.getMonthlyLimit());
					    uiCommonUtils.setValueUIComponent(editCashServiceProfileView.getTxtTransactionAmountLimit(),
						    resultServiceProfileBean.getTransactionAmountLimit());

					    uiCommonUtils.setValueUIComponent(editCashServiceProfileView.getTxtProjectContactName(),
						    resultServiceProfileBean.getContact1Name());
					    uiCommonUtils.setValueUIComponent(editCashServiceProfileView.getTxtProjectContactPhone(),
						    resultServiceProfileBean.getContact1Phone());
					    uiCommonUtils.setValueUIComponent(editCashServiceProfileView.getTxtProjectContactMobile(),
						    resultServiceProfileBean.getContact1Mobile());
					    uiCommonUtils.setValueUIComponent(
						    editCashServiceProfileView.getTxtProjectContactEmailAddress(),
						    resultServiceProfileBean.getContact1Email());

					    uiCommonUtils.setValueUIComponent(editCashServiceProfileView.getTxtOperationContactName(),
						    resultServiceProfileBean.getContact2Name());
					    uiCommonUtils.setValueUIComponent(editCashServiceProfileView.getTxtOperationContactPhone(),
						    resultServiceProfileBean.getContact2Phone());
					    uiCommonUtils.setValueUIComponent(editCashServiceProfileView.getTxtOperationContactMobile(),
						    resultServiceProfileBean.getContact2Mobile());
					    uiCommonUtils.setValueUIComponent(
						    editCashServiceProfileView.getTxtOperationContactEmailAddress(),
						    resultServiceProfileBean.getContact2Email());

					    uiCommonUtils.setValueUIComponent(editCashServiceProfileView.getTxtTechnicalContactName(),
						    resultServiceProfileBean.getContact3Name());
					    uiCommonUtils.setValueUIComponent(editCashServiceProfileView.getTxtTechnicalContactPhone(),
						    resultServiceProfileBean.getContact3Phone());
					    uiCommonUtils.setValueUIComponent(editCashServiceProfileView.getTxtTechnicalContactMobile(),
						    resultServiceProfileBean.getContact3Mobile());
					    uiCommonUtils.setValueUIComponent(
						    editCashServiceProfileView.getTxtTechnicalContactEmailAddress(),
						    resultServiceProfileBean.getContact3Email());

					    uiCommonUtils.setValueUIComponent(editCashServiceProfileView.getTxtFinancialContactName(),
						    resultServiceProfileBean.getContact4Name());
					    uiCommonUtils.setValueUIComponent(editCashServiceProfileView.getTxtFinancialContactPhone(),
						    resultServiceProfileBean.getContact4Phone());
					    uiCommonUtils.setValueUIComponent(editCashServiceProfileView.getTxtFinancialContactMobile(),
						    resultServiceProfileBean.getContact4Mobile());
					    uiCommonUtils.setValueUIComponent(
						    editCashServiceProfileView.getTxtFinancialContactEmailAddress(),
						    resultServiceProfileBean.getContact4Email());

					    uiCommonUtils.clearAllUIComponentNoInputFieldWithPrefix(editCashServiceProfileView);

					    String closeStatus = propertyBAO
						    .getPropertyValue("com.fw.ui.view.profile.EditCashServiceProfileView.status.item.closed");
					    if (closeStatus.equals(resultServiceProfileBean.getServiceStatus())) {
						setAutoEnabled(false);
						List<com.vaadin.ui.Component> componentsEnable = new ArrayList<com.vaadin.ui.Component>();
						componentsEnable.add(editCashServiceProfileView.getBtnCancel());
						uiCommonUtils.setEnableAllUIComponent(editCashServiceProfileView, componentsEnable, false);
					    }

					    result.put(MessageBAO.MESSAGE_INFO_TYPE,
						    "com.fw.ui.view.profile.EditCashServiceProfileView.message.updated");
					} else {
					    result.put(MessageBAO.MESSAGE_WARNING_TYPE,
						    "com.fw.ui.view.profile.EditCashServiceProfileView.message.failed");
					}
				    }
				} else {
				    result.put(MessageBAO.MESSAGE_WARNING_TYPE, "message.error.common");
				}
			    } catch (Exception e) {
				result.put(MessageBAO.MESSAGE_WARNING_TYPE, "message.error.common");
			    }
			    // notification
			    notification(result);
			}
		    }
		}, "255px", "650px");

	return null;
    }

    @Override
    public boolean validate(ClickEvent event) {
	boolean validate = false;
	EditCashServiceProfileView editCashServiceProfileView = (EditCashServiceProfileView) this.getBasedComponent();
	try {

	    uiCommonUtils.clearAllUIComponentNoInputFieldWithPrefix(editCashServiceProfileView);

	    boolean isTestServiceValid = editCashServiceProfileView.getCbIsTestService().isValid();
	    boolean serviceIdValid = editCashServiceProfileView.getTxtServiceId().isValid();
	    boolean merchantIdValid = editCashServiceProfileView.getCbbMerchantId().isValid();
	    boolean serviceStatusValid = editCashServiceProfileView.getCbbServiceStatus().isValid();
	    boolean hostValid = editCashServiceProfileView.getCbbHost().isValid();
	    boolean bankGuaranteeValid = editCashServiceProfileView.getTxtBankGuarantee().isValid();
	    boolean bankGuaranteeExpireDateValid = editCashServiceProfileView.getPdfBankGuaranteeExpireDate().isValid();
	    boolean chequeNameValid = editCashServiceProfileView.getTxtChequeName().isValid();
	    boolean launchedDateValid = editCashServiceProfileView.getPdfLaunchedDate().isValid();
	    boolean isNotifyCustomerValid = editCashServiceProfileView.getCbIsNotifyCustomer().isValid();
	    boolean responseUrlBackValid = editCashServiceProfileView.getTxtResponseUrlBack().isValid();
	    boolean successUrlValid = editCashServiceProfileView.getTxtSuccessUrl().isValid();
	    boolean faileUrlValid = editCashServiceProfileView.getTxtFailUrl().isValid();
	    boolean cancelUrlValid = editCashServiceProfileView.getTxtCancelUrl().isValid();

	    boolean invoiceAgingValid = editCashServiceProfileView.getTxtInvoiceAging().isValid();
	    boolean isBypassInvoiceAgingValid = editCashServiceProfileView.getCbIsBypassInvoiceAging().isValid();
	    boolean bankCodeAndNameValid = editCashServiceProfileView.getCbbBankCodeAndName().isValid();
	    boolean bankAccountNoValid = editCashServiceProfileView.getTxtBankAccountNo().isValid();
	    boolean sapArCodeValid = editCashServiceProfileView.getTxtSapArCode().isValid();
	    boolean sapApCodeValid = editCashServiceProfileView.getTxtSapApCode().isValid();
	    boolean messageSlip1Valid = editCashServiceProfileView.getTxtMessageSlip1().isValid();
	    boolean messageSlip2Valid = editCashServiceProfileView.getTxtMessageSlip2().isValid();
	    boolean mdrValid = editCashServiceProfileView.getTxtMdr().isValid();
	    boolean serviceFeeValid = editCashServiceProfileView.getTxtServiceFee().isValid();

	    boolean dailyLimitValid = editCashServiceProfileView.getTxtDailyLimit().isValid();
	    boolean monthlyLimitValid = editCashServiceProfileView.getTxtMonthlyLimit().isValid();
	    boolean transactionAmountLimitValid = editCashServiceProfileView.getTxtTransactionAmountLimit().isValid();

	    boolean projectContactNameValid = editCashServiceProfileView.getTxtProjectContactName().isValid();
	    boolean projectContactPhoneValid = editCashServiceProfileView.getTxtProjectContactPhone().isValid();
	    boolean projectContactMobileValid = editCashServiceProfileView.getTxtProjectContactMobile().isValid();
	    boolean projectContactEmailAddressValid = editCashServiceProfileView.getTxtProjectContactEmailAddress().isValid();
	    boolean technicalContactNameValid = editCashServiceProfileView.getTxtTechnicalContactName().isValid();
	    boolean technicalContactPhoneValid = editCashServiceProfileView.getTxtTechnicalContactPhone().isValid();
	    boolean technicalContactMobileValid = editCashServiceProfileView.getTxtTechnicalContactMobile().isValid();
	    boolean technicalContactEmailAddressValid = editCashServiceProfileView.getTxtTechnicalContactEmailAddress().isValid();
	    boolean operationContactNameValid = editCashServiceProfileView.getTxtOperationContactName().isValid();
	    boolean operationContactPhoneValid = editCashServiceProfileView.getTxtOperationContactPhone().isValid();
	    boolean operationContactMobileValid = editCashServiceProfileView.getTxtOperationContactMobile().isValid();
	    boolean operationContactEmailAddressValid = editCashServiceProfileView.getTxtOperationContactEmailAddress().isValid();
	    boolean financialContactNameValid = editCashServiceProfileView.getTxtFinancialContactName().isValid();
	    boolean financialContactPhoneValid = editCashServiceProfileView.getTxtFinancialContactPhone().isValid();
	    boolean financialContactMobileValid = editCashServiceProfileView.getTxtFinancialContactMobile().isValid();
	    boolean financialContactEmailAddressValid = editCashServiceProfileView.getTxtFinancialContactEmailAddress().isValid();

	    if (isTestServiceValid && serviceIdValid && merchantIdValid && serviceStatusValid && hostValid && bankGuaranteeValid
		    && bankGuaranteeExpireDateValid && chequeNameValid && launchedDateValid && isNotifyCustomerValid
		    && responseUrlBackValid && successUrlValid && faileUrlValid && cancelUrlValid && invoiceAgingValid
		    && isBypassInvoiceAgingValid && bankCodeAndNameValid && bankAccountNoValid && sapArCodeValid && sapApCodeValid
		    && messageSlip1Valid && messageSlip2Valid && mdrValid && serviceFeeValid && dailyLimitValid && monthlyLimitValid
		    && transactionAmountLimitValid && projectContactNameValid && projectContactPhoneValid && projectContactMobileValid
		    && projectContactEmailAddressValid && technicalContactNameValid && technicalContactPhoneValid
		    && technicalContactMobileValid && technicalContactEmailAddressValid && operationContactNameValid
		    && operationContactPhoneValid && operationContactMobileValid && operationContactEmailAddressValid
		    && financialContactNameValid && financialContactPhoneValid && financialContactMobileValid
		    && financialContactEmailAddressValid) {
		validate = true;
	    } else {
		if (!isTestServiceValid) {
		    editCashServiceProfileView.getCbIsTestService().addStyleName("v-textfield-error");
		    if (editCashServiceProfileView.getCbIsTestService().getErrorMessage() != null) {
			editCashServiceProfileView.getLblIsTestServiceValidateMessage().setValue(
				editCashServiceProfileView.getCbIsTestService().getErrorMessage().getFormattedHtmlMessage());
		    }
		    editCashServiceProfileView.getLayoutIsTestServiceValidate().setVisible(true);
		}
		if (!serviceIdValid) {
		    editCashServiceProfileView.getTxtServiceId().addStyleName("v-textfield-error");
		    if (editCashServiceProfileView.getTxtServiceId().getErrorMessage() != null) {
			editCashServiceProfileView.getLblServiceIdValidateMessage().setValue(
				editCashServiceProfileView.getTxtServiceId().getErrorMessage().getFormattedHtmlMessage());
		    }
		    editCashServiceProfileView.getLayoutServiceIdValidate().setVisible(true);
		}
		if (!merchantIdValid) {
		    editCashServiceProfileView.getCbbMerchantId().addStyleName("v-textfield-error");
		    if (editCashServiceProfileView.getCbbMerchantId().getErrorMessage() != null) {
			editCashServiceProfileView.getLblMerchantIdValidateMessage().setValue(
				editCashServiceProfileView.getCbbMerchantId().getErrorMessage().getFormattedHtmlMessage());
		    }
		    editCashServiceProfileView.getLayoutMerchantIdValidate().setVisible(true);
		}
		if (!serviceStatusValid) {
		    editCashServiceProfileView.getCbbServiceStatus().addStyleName("v-textfield-error");
		    if (editCashServiceProfileView.getCbbServiceStatus().getErrorMessage() != null) {
			editCashServiceProfileView.getLblServiceStatusValidateMessage().setValue(
				editCashServiceProfileView.getCbbServiceStatus().getErrorMessage().getFormattedHtmlMessage());
		    }
		    editCashServiceProfileView.getLayoutServiceStatusValidate().setVisible(true);
		}
		if (!hostValid) {
		    editCashServiceProfileView.getCbbHost().addStyleName("v-textfield-error");
		    if (editCashServiceProfileView.getCbbHost().getErrorMessage() != null) {
			editCashServiceProfileView.getLblHostValidateMessage().setValue(
				editCashServiceProfileView.getCbbHost().getErrorMessage().getFormattedHtmlMessage());
		    }
		    editCashServiceProfileView.getLayoutHostValidate().setVisible(true);
		}
		if (!bankGuaranteeValid) {
		    editCashServiceProfileView.getTxtBankGuarantee().addStyleName("v-textfield-error");
		    if (editCashServiceProfileView.getTxtBankGuarantee().getErrorMessage() != null) {
			editCashServiceProfileView.getLblBankGuaranteeValidateMessage().setValue(
				editCashServiceProfileView.getTxtBankGuarantee().getErrorMessage().getFormattedHtmlMessage());
		    }
		    editCashServiceProfileView.getLayoutBankGuaranteeValidate().setVisible(true);
		}

		if (!bankGuaranteeExpireDateValid) {
		    editCashServiceProfileView.getPdfBankGuaranteeExpireDate().addStyleName("v-textfield-error");
		    if (editCashServiceProfileView.getPdfBankGuaranteeExpireDate().getErrorMessage() != null) {
			editCashServiceProfileView.getLblBankGuaranteeExpireDateValidateMessage().setValue(
				editCashServiceProfileView.getPdfBankGuaranteeExpireDate().getErrorMessage().getFormattedHtmlMessage());
		    }
		    editCashServiceProfileView.getLayoutBankGuaranteeExpireDateValidate().setVisible(true);
		}
		if (!chequeNameValid) {
		    editCashServiceProfileView.getTxtChequeName().addStyleName("v-textfield-error");
		    if (editCashServiceProfileView.getTxtChequeName().getErrorMessage() != null) {
			editCashServiceProfileView.getLblChequeNameValidateMessage().setValue(
				editCashServiceProfileView.getTxtChequeName().getErrorMessage().getFormattedHtmlMessage());
		    }
		    editCashServiceProfileView.getLayoutChequeNameValidate().setVisible(true);
		}
		if (!launchedDateValid) {
		    editCashServiceProfileView.getPdfLaunchedDate().addStyleName("v-textfield-error");
		    if (editCashServiceProfileView.getPdfLaunchedDate().getErrorMessage() != null) {
			editCashServiceProfileView.getLblLaunchedDateValidateMessage().setValue(
				editCashServiceProfileView.getPdfLaunchedDate().getErrorMessage().getFormattedHtmlMessage());
		    }
		    editCashServiceProfileView.getLayoutLaunchedDateValidate().setVisible(true);
		}
		if (!isNotifyCustomerValid) {
		    editCashServiceProfileView.getCbIsNotifyCustomer().addStyleName("v-textfield-error");
		    if (editCashServiceProfileView.getCbIsNotifyCustomer().getErrorMessage() != null) {
			editCashServiceProfileView.getLblNotifyCustomerValidateMessage().setValue(
				editCashServiceProfileView.getCbIsNotifyCustomer().getErrorMessage().getFormattedHtmlMessage());
		    }
		    editCashServiceProfileView.getLayoutNotifyCustomerValidate().setVisible(true);
		}
		if (!responseUrlBackValid) {
		    editCashServiceProfileView.getTxtResponseUrlBack().addStyleName("v-textfield-error");
		    if (editCashServiceProfileView.getTxtResponseUrlBack().getErrorMessage() != null) {
			editCashServiceProfileView.getLblResponseUrlBackValidateMessage().setValue(
				editCashServiceProfileView.getTxtResponseUrlBack().getErrorMessage().getFormattedHtmlMessage());
		    }
		    editCashServiceProfileView.getLayoutResponseUrlBackValidate().setVisible(true);
		}

		if (!successUrlValid) {
		    editCashServiceProfileView.getTxtSuccessUrl().addStyleName("v-textfield-error");
		    if (editCashServiceProfileView.getTxtSuccessUrl().getErrorMessage() != null) {
			editCashServiceProfileView.getLblSuccessUrlValidateMessage().setValue(
				editCashServiceProfileView.getTxtSuccessUrl().getErrorMessage().getFormattedHtmlMessage());
		    }
		    editCashServiceProfileView.getLayoutSuccessUrlValidate().setVisible(true);
		}

		if (!faileUrlValid) {
		    editCashServiceProfileView.getTxtFailUrl().addStyleName("v-textfield-error");
		    if (editCashServiceProfileView.getTxtFailUrl().getErrorMessage() != null) {
			editCashServiceProfileView.getLblFailUrlValidateMessage().setValue(
				editCashServiceProfileView.getTxtFailUrl().getErrorMessage().getFormattedHtmlMessage());
		    }
		    editCashServiceProfileView.getLayoutFailUrlValidate().setVisible(true);
		}

		if (!cancelUrlValid) {
		    editCashServiceProfileView.getTxtCancelUrl().addStyleName("v-textfield-error");
		    if (editCashServiceProfileView.getTxtCancelUrl().getErrorMessage() != null) {
			editCashServiceProfileView.getLblCancelUrlValidateMessage().setValue(
				editCashServiceProfileView.getTxtCancelUrl().getErrorMessage().getFormattedHtmlMessage());
		    }
		    editCashServiceProfileView.getLayoutCancelUrlValidate().setVisible(true);
		}

		if (!invoiceAgingValid) {
		    editCashServiceProfileView.getTxtInvoiceAging().addStyleName("v-textfield-error");
		    if (editCashServiceProfileView.getTxtInvoiceAging().getErrorMessage() != null) {
			editCashServiceProfileView.getLblInvoiceAgingValidateMessage().setValue(
				editCashServiceProfileView.getTxtInvoiceAging().getErrorMessage().getFormattedHtmlMessage());
		    }
		    editCashServiceProfileView.getLayoutInvoiceAgingValidate().setVisible(true);
		}
		if (!isBypassInvoiceAgingValid) {
		    editCashServiceProfileView.getCbIsBypassInvoiceAging().addStyleName("v-textfield-error");
		    if (editCashServiceProfileView.getCbIsBypassInvoiceAging().getErrorMessage() != null) {
			editCashServiceProfileView.getLblBypassInvoiceAgingValidateMessage().setValue(
				editCashServiceProfileView.getCbIsBypassInvoiceAging().getErrorMessage().getFormattedHtmlMessage());
		    }
		    editCashServiceProfileView.getLayoutBypassInvoiceAgingValidate().setVisible(true);
		}
		if (!bankCodeAndNameValid) {
		    editCashServiceProfileView.getCbbBankCodeAndName().addStyleName("v-textfield-error");
		    if (editCashServiceProfileView.getCbbBankCodeAndName().getErrorMessage() != null) {
			editCashServiceProfileView.getLblBankCodeAndNameValidateMessage().setValue(
				editCashServiceProfileView.getCbbBankCodeAndName().getErrorMessage().getFormattedHtmlMessage());
		    }
		    editCashServiceProfileView.getLayoutBankCodeAndNameValidate().setVisible(true);
		}
		if (!bankAccountNoValid) {
		    editCashServiceProfileView.getTxtBankAccountNo().addStyleName("v-textfield-error");
		    if (editCashServiceProfileView.getTxtBankAccountNo().getErrorMessage() != null) {
			editCashServiceProfileView.getLblBankAccountNoValidateMessage().setValue(
				editCashServiceProfileView.getTxtBankAccountNo().getErrorMessage().getFormattedHtmlMessage());
		    }
		    editCashServiceProfileView.getLayoutBankAccountNoValidate().setVisible(true);
		}
		if (!sapArCodeValid) {
		    editCashServiceProfileView.getTxtSapArCode().addStyleName("v-textfield-error");
		    if (editCashServiceProfileView.getTxtSapArCode().getErrorMessage() != null) {
			editCashServiceProfileView.getLblSapArCodeValidateMessage().setValue(
				editCashServiceProfileView.getTxtSapArCode().getErrorMessage().getFormattedHtmlMessage());
		    }
		    editCashServiceProfileView.getLayoutSapArCodeValidate().setVisible(true);
		}
		if (!sapApCodeValid) {
		    editCashServiceProfileView.getTxtSapApCode().addStyleName("v-textfield-error");
		    if (editCashServiceProfileView.getTxtSapApCode().getErrorMessage() != null) {
			editCashServiceProfileView.getLblSapApCodeValidateMessage().setValue(
				editCashServiceProfileView.getTxtSapApCode().getErrorMessage().getFormattedHtmlMessage());
		    }
		    editCashServiceProfileView.getLayoutSapApCodeValidate().setVisible(true);
		}
		if (!messageSlip1Valid) {
		    editCashServiceProfileView.getTxtMessageSlip1().addStyleName("v-textfield-error");
		    if (editCashServiceProfileView.getTxtMessageSlip1().getErrorMessage() != null) {
			editCashServiceProfileView.getLblMessageSlip1ValidateMessage().setValue(
				editCashServiceProfileView.getTxtMessageSlip1().getErrorMessage().getFormattedHtmlMessage());
		    }
		    editCashServiceProfileView.getLayoutMessageSlip1Validate().setVisible(true);
		}
		if (!messageSlip2Valid) {
		    editCashServiceProfileView.getTxtMessageSlip2().addStyleName("v-textfield-error");
		    if (editCashServiceProfileView.getTxtMessageSlip2().getErrorMessage() != null) {
			editCashServiceProfileView.getLblMessageSlip2ValidateMessage().setValue(
				editCashServiceProfileView.getTxtMessageSlip2().getErrorMessage().getFormattedHtmlMessage());
		    }
		    editCashServiceProfileView.getLayoutMessageSlip2Validate().setVisible(true);
		}
		if (!mdrValid) {
		    editCashServiceProfileView.getTxtMdr().addStyleName("v-textfield-error");
		    if (editCashServiceProfileView.getTxtMdr().getErrorMessage() != null) {
			editCashServiceProfileView.getLblMdrValidateMessage().setValue(
				editCashServiceProfileView.getTxtMdr().getErrorMessage().getFormattedHtmlMessage());
		    }
		    editCashServiceProfileView.getLayoutMdrValidate().setVisible(true);
		}
		if (!serviceFeeValid) {
		    editCashServiceProfileView.getTxtServiceFee().addStyleName("v-textfield-error");
		    if (editCashServiceProfileView.getTxtServiceFee().getErrorMessage() != null) {
			editCashServiceProfileView.getLblServiceFeeValidateMessage().setValue(
				editCashServiceProfileView.getTxtServiceFee().getErrorMessage().getFormattedHtmlMessage());
		    }
		    editCashServiceProfileView.getLayoutServiceFeeValidate().setVisible(true);
		}

		if (!dailyLimitValid) {
		    editCashServiceProfileView.getTxtDailyLimit().addStyleName("v-textfield-error");
		    if (editCashServiceProfileView.getTxtDailyLimit().getErrorMessage() != null) {
			editCashServiceProfileView.getLblDailyLimitValidateMessage().setValue(
				editCashServiceProfileView.getTxtDailyLimit().getErrorMessage().getFormattedHtmlMessage());
		    }
		    editCashServiceProfileView.getLayoutDailyLimitValidate().setVisible(true);
		}
		if (!monthlyLimitValid) {
		    editCashServiceProfileView.getTxtMonthlyLimit().addStyleName("v-textfield-error");
		    if (editCashServiceProfileView.getTxtMonthlyLimit().getErrorMessage() != null) {
			editCashServiceProfileView.getLblMonthlyLimitValidateMessage().setValue(
				editCashServiceProfileView.getTxtMonthlyLimit().getErrorMessage().getFormattedHtmlMessage());
		    }
		    editCashServiceProfileView.getLayoutMonthlyLimitValidate().setVisible(true);
		}
		if (!transactionAmountLimitValid) {
		    editCashServiceProfileView.getTxtTransactionAmountLimit().addStyleName("v-textfield-error");
		    if (editCashServiceProfileView.getTxtTransactionAmountLimit().getErrorMessage() != null) {
			editCashServiceProfileView.getLblTransactionAmountLimitValidateMessage().setValue(
				editCashServiceProfileView.getTxtTransactionAmountLimit().getErrorMessage().getFormattedHtmlMessage());
		    }
		    editCashServiceProfileView.getLayoutTransactionAmountLimitValidate().setVisible(true);
		}

		// project
		if (!projectContactNameValid) {
		    editCashServiceProfileView.getTxtProjectContactName().addStyleName("v-textfield-error");
		    if (editCashServiceProfileView.getTxtProjectContactName().getErrorMessage() != null) {
			editCashServiceProfileView.getLblProjectContactNameValidateMessage().setValue(
				editCashServiceProfileView.getTxtProjectContactName().getErrorMessage().getFormattedHtmlMessage());
		    }
		    editCashServiceProfileView.getLayoutProjectContactNameValidate().setVisible(true);
		}
		if (!projectContactPhoneValid) {
		    editCashServiceProfileView.getTxtProjectContactPhone().addStyleName("v-textfield-error");
		    if (editCashServiceProfileView.getTxtProjectContactPhone().getErrorMessage() != null) {
			editCashServiceProfileView.getLblProjectContactPhoneValidateMessage().setValue(
				editCashServiceProfileView.getTxtProjectContactPhone().getErrorMessage().getFormattedHtmlMessage());
		    }
		    editCashServiceProfileView.getLayoutProjectContactPhoneValidate().setVisible(true);
		}
		if (!projectContactMobileValid) {
		    editCashServiceProfileView.getTxtProjectContactMobile().addStyleName("v-textfield-error");
		    if (editCashServiceProfileView.getTxtProjectContactMobile().getErrorMessage() != null) {
			editCashServiceProfileView.getLblProjectContactMobileValidateMessage().setValue(
				editCashServiceProfileView.getTxtProjectContactMobile().getErrorMessage().getFormattedHtmlMessage());
		    }
		    editCashServiceProfileView.getLayoutProjectContactMobileValidate().setVisible(true);
		}
		if (!projectContactEmailAddressValid) {
		    editCashServiceProfileView.getTxtProjectContactEmailAddress().addStyleName("v-textfield-error");
		    if (editCashServiceProfileView.getTxtProjectContactEmailAddress().getErrorMessage() != null) {
			editCashServiceProfileView.getLblProjectContactEmailAddressValidateMessage().setValue(
				editCashServiceProfileView.getTxtProjectContactEmailAddress().getErrorMessage().getFormattedHtmlMessage());
		    }
		    editCashServiceProfileView.getLayoutProjectContactEmailAddressValidate().setVisible(true);
		}
		// operation
		if (!operationContactNameValid) {
		    editCashServiceProfileView.getTxtOperationContactName().addStyleName("v-textfield-error");
		    if (editCashServiceProfileView.getTxtOperationContactName().getErrorMessage() != null) {
			editCashServiceProfileView.getLblOperationContactNameValidateMessage().setValue(
				editCashServiceProfileView.getTxtOperationContactName().getErrorMessage().getFormattedHtmlMessage());
		    }
		    editCashServiceProfileView.getLayoutOperationContactNameValidate().setVisible(true);
		}
		if (!operationContactPhoneValid) {
		    editCashServiceProfileView.getTxtOperationContactPhone().addStyleName("v-textfield-error");
		    if (editCashServiceProfileView.getTxtOperationContactPhone().getErrorMessage() != null) {
			editCashServiceProfileView.getLblOperationContactPhoneValidateMessage().setValue(
				editCashServiceProfileView.getTxtOperationContactPhone().getErrorMessage().getFormattedHtmlMessage());
		    }
		    editCashServiceProfileView.getLayoutOperationContactPhoneValidate().setVisible(true);
		}
		if (!operationContactMobileValid) {
		    editCashServiceProfileView.getTxtOperationContactMobile().addStyleName("v-textfield-error");
		    if (editCashServiceProfileView.getTxtOperationContactMobile().getErrorMessage() != null) {
			editCashServiceProfileView.getLblOperationContactMobileValidateMessage().setValue(
				editCashServiceProfileView.getTxtOperationContactMobile().getErrorMessage().getFormattedHtmlMessage());
		    }
		    editCashServiceProfileView.getLayoutOperationContactMobileValidate().setVisible(true);
		}
		if (!operationContactEmailAddressValid) {
		    editCashServiceProfileView.getTxtOperationContactEmailAddress().addStyleName("v-textfield-error");
		    if (editCashServiceProfileView.getTxtOperationContactEmailAddress().getErrorMessage() != null) {
			editCashServiceProfileView.getLblOperationContactEmailAddressValidateMessage()
				.setValue(
					editCashServiceProfileView.getTxtOperationContactEmailAddress().getErrorMessage()
						.getFormattedHtmlMessage());
		    }
		    editCashServiceProfileView.getLayoutOperationContactEmailAddressValidate().setVisible(true);
		}
		// technical
		if (!technicalContactNameValid) {
		    editCashServiceProfileView.getTxtTechnicalContactName().addStyleName("v-textfield-error");
		    if (editCashServiceProfileView.getTxtTechnicalContactName().getErrorMessage() != null) {
			editCashServiceProfileView.getLblTechnicalContactNameValidateMessage().setValue(
				editCashServiceProfileView.getTxtTechnicalContactName().getErrorMessage().getFormattedHtmlMessage());
		    }
		    editCashServiceProfileView.getLayoutTechnicalContactNameValidate().setVisible(true);
		}
		if (!technicalContactPhoneValid) {
		    editCashServiceProfileView.getTxtTechnicalContactPhone().addStyleName("v-textfield-error");
		    if (editCashServiceProfileView.getTxtTechnicalContactPhone().getErrorMessage() != null) {
			editCashServiceProfileView.getLblTechnicalContactPhoneValidateMessage().setValue(
				editCashServiceProfileView.getTxtTechnicalContactPhone().getErrorMessage().getFormattedHtmlMessage());
		    }
		    editCashServiceProfileView.getLayoutTechnicalContactPhoneValidate().setVisible(true);
		}
		if (!technicalContactMobileValid) {
		    editCashServiceProfileView.getTxtTechnicalContactMobile().addStyleName("v-textfield-error");
		    if (editCashServiceProfileView.getTxtTechnicalContactMobile().getErrorMessage() != null) {
			editCashServiceProfileView.getLblTechnicalContactMobileValidateMessage().setValue(
				editCashServiceProfileView.getTxtTechnicalContactMobile().getErrorMessage().getFormattedHtmlMessage());
		    }
		    editCashServiceProfileView.getLayoutTechnicalContactMobileValidate().setVisible(true);
		}
		if (!technicalContactEmailAddressValid) {
		    editCashServiceProfileView.getTxtTechnicalContactEmailAddress().addStyleName("v-textfield-error");
		    if (editCashServiceProfileView.getTxtTechnicalContactEmailAddress().getErrorMessage() != null) {
			editCashServiceProfileView.getLblTechnicalContactEmailAddressValidateMessage()
				.setValue(
					editCashServiceProfileView.getTxtTechnicalContactEmailAddress().getErrorMessage()
						.getFormattedHtmlMessage());
		    }
		    editCashServiceProfileView.getLayoutTechnicalContactEmailAddressValidate().setVisible(true);
		}
		// financial
		if (!financialContactNameValid) {
		    editCashServiceProfileView.getTxtFinancialContactName().addStyleName("v-textfield-error");
		    if (editCashServiceProfileView.getTxtFinancialContactName().getErrorMessage() != null) {
			editCashServiceProfileView.getLblFinancialContactNameValidateMessage().setValue(
				editCashServiceProfileView.getTxtFinancialContactName().getErrorMessage().getFormattedHtmlMessage());
		    }
		    editCashServiceProfileView.getLayoutFinancialContactNameValidate().setVisible(true);
		}
		if (!financialContactPhoneValid) {
		    editCashServiceProfileView.getTxtFinancialContactPhone().addStyleName("v-textfield-error");
		    if (editCashServiceProfileView.getTxtFinancialContactPhone().getErrorMessage() != null) {
			editCashServiceProfileView.getLblFinancialContactPhoneValidateMessage().setValue(
				editCashServiceProfileView.getTxtFinancialContactPhone().getErrorMessage().getFormattedHtmlMessage());
		    }
		    editCashServiceProfileView.getLayoutFinancialContactPhoneValidate().setVisible(true);
		}
		if (!financialContactMobileValid) {
		    editCashServiceProfileView.getTxtFinancialContactMobile().addStyleName("v-textfield-error");
		    if (editCashServiceProfileView.getTxtFinancialContactMobile().getErrorMessage() != null) {
			editCashServiceProfileView.getLblFinancialContactMobileValidateMessage().setValue(
				editCashServiceProfileView.getTxtFinancialContactMobile().getErrorMessage().getFormattedHtmlMessage());
		    }
		    editCashServiceProfileView.getLayoutFinancialContactMobileValidate().setVisible(true);
		}
		if (!financialContactEmailAddressValid) {
		    editCashServiceProfileView.getTxtFinancialContactEmailAddress().addStyleName("v-textfield-error");
		    if (editCashServiceProfileView.getTxtFinancialContactEmailAddress().getErrorMessage() != null) {
			editCashServiceProfileView.getLblFinancialContactEmailAddressValidateMessage()
				.setValue(
					editCashServiceProfileView.getTxtFinancialContactEmailAddress().getErrorMessage()
						.getFormattedHtmlMessage());
		    }
		    editCashServiceProfileView.getLayoutFinancialContactEmailAddressValidate().setVisible(true);
		}

	    }
	} catch (Exception e) {
	    e.printStackTrace();
	}
	return validate;
    }

    @SuppressWarnings("rawtypes")
    private List<BeanItem> generateTableItemBean(ServiceProfileBean oldServiceProfileBean, ServiceProfileBean serviceProfileBean) {
	EditCashServiceProfileView editCashServiceProfileView = (EditCashServiceProfileView) this.getBasedComponent();
	List<EditMerchantProfileTableItemBean> itemBeans = new ArrayList<EditMerchantProfileTableItemBean>();
	List<BeanItem> beanItems = new ArrayList<BeanItem>();
	// process
	if (DataUtils.isChange(oldServiceProfileBean.getIsTestService(), serviceProfileBean.getIsTestService())) {
	    itemBeans.add(new EditMerchantProfileTableItemBean(messageBAO
		    .getMessage("com.fw.ui.view.profile.EditCashServiceProfileView.label.isTestService"), DataUtils
		    .stringValue(oldServiceProfileBean.getIsTestService()), DataUtils.stringValue(serviceProfileBean.getIsTestService())));
	}
	if (DataUtils.isChange(oldServiceProfileBean.getServiceStatus(), serviceProfileBean.getServiceStatus())) {
	    String oldValue = editCashServiceProfileView.getCbbServiceStatus().getItemCaption(oldServiceProfileBean.getServiceStatus());
	    String newValue = editCashServiceProfileView.getCbbServiceStatus().getItemCaption(serviceProfileBean.getServiceStatus());
	    itemBeans.add(new EditMerchantProfileTableItemBean(messageBAO
		    .getMessage("com.fw.ui.view.profile.EditCashServiceProfileView.label.serviceStatus"), DataUtils.stringValue(oldValue),
		    DataUtils.stringValue(newValue)));
	}
	if (DataUtils.isChange(oldServiceProfileBean.getHost(), serviceProfileBean.getHost())) {
	    String oldValue = editCashServiceProfileView.getCbbHost().getItemCaption(oldServiceProfileBean.getHost());
	    String newValue = editCashServiceProfileView.getCbbHost().getItemCaption(serviceProfileBean.getHost());
	    itemBeans.add(new EditMerchantProfileTableItemBean(messageBAO
		    .getMessage("com.fw.ui.view.profile.EditCashServiceProfileView.label.host"), DataUtils.stringValue(oldValue), DataUtils
		    .stringValue(newValue)));
	}
	if (DataUtils.isChange(oldServiceProfileBean.getIsBankGuarantee(), serviceProfileBean.getIsBankGuarantee())) {
	    itemBeans.add(new EditMerchantProfileTableItemBean(messageBAO
		    .getMessage("com.fw.ui.view.profile.EditCashServiceProfileView.label.bankGuarantee"), DataUtils
		    .stringValue(oldServiceProfileBean.getIsBankGuarantee()),
		    DataUtils.stringValue(serviceProfileBean.getIsBankGuarantee())));
	}
	if (DataUtils.isChange(oldServiceProfileBean.getBankGuarantee(), serviceProfileBean.getBankGuarantee())) {
	    itemBeans.add(new EditMerchantProfileTableItemBean(messageBAO
		    .getMessage("com.fw.ui.view.profile.EditCashServiceProfileView.label.bankGuarantee"), DataUtils
		    .stringValue(oldServiceProfileBean.getBankGuarantee()), DataUtils.stringValue(serviceProfileBean.getBankGuarantee())));
	}
	if (DataUtils.isChange(oldServiceProfileBean.getBankGuaranteeExpireDate(), serviceProfileBean.getBankGuaranteeExpireDate())) {
	    String oldValue = "";
	    if (oldServiceProfileBean.getBankGuaranteeExpireDate() != null && !oldServiceProfileBean.getBankGuaranteeExpireDate().isEmpty()) {
		oldValue = StringUtils.formatDate(StringUtils.parseDate(oldServiceProfileBean.getBankGuaranteeExpireDate(),
			StringUtils.PATTERN_MONTH_YEAR_PERSISTENCE), StringUtils.PATTERN_MONTH_YEAR_UI);
	    }
	    String newValue = "";
	    if (serviceProfileBean.getBankGuaranteeExpireDate() != null && !serviceProfileBean.getBankGuaranteeExpireDate().isEmpty()) {
		newValue = StringUtils.formatDate(
			StringUtils.parseDate(serviceProfileBean.getBankGuaranteeExpireDate(), StringUtils.PATTERN_MONTH_YEAR_PERSISTENCE),
			StringUtils.PATTERN_MONTH_YEAR_UI);
	    }
	    itemBeans.add(new EditMerchantProfileTableItemBean(messageBAO
		    .getMessage("com.fw.ui.view.profile.EditCashServiceProfileView.label.bankGuaranteeExpireDate"), DataUtils
		    .stringValue(oldValue), DataUtils.stringValue(newValue)));
	}
	if (DataUtils.isChange(oldServiceProfileBean.getChequeName(), serviceProfileBean.getChequeName())) {
	    itemBeans.add(new EditMerchantProfileTableItemBean(messageBAO
		    .getMessage("com.fw.ui.view.profile.EditCashServiceProfileView.label.chequeName"), DataUtils
		    .stringValue(oldServiceProfileBean.getChequeName()), DataUtils.stringValue(serviceProfileBean.getChequeName())));
	}
	if (DataUtils.isChange(oldServiceProfileBean.getLaunchedDate(), serviceProfileBean.getLaunchedDate())) {
	    String oldValue = "";
	    if (oldServiceProfileBean.getLaunchedDate() != null && !oldServiceProfileBean.getLaunchedDate().isEmpty()) {
		oldValue = StringUtils.formatDate(
			StringUtils.parseDate(oldServiceProfileBean.getLaunchedDate(), StringUtils.PATTERN_DATE_PERSISTENCE),
			StringUtils.PATTERN_DATE_UI);
	    }
	    String newValue = "";
	    if (serviceProfileBean.getLaunchedDate() != null && !serviceProfileBean.getLaunchedDate().isEmpty()) {
		newValue = StringUtils.formatDate(
			StringUtils.parseDate(serviceProfileBean.getLaunchedDate(), StringUtils.PATTERN_DATE_PERSISTENCE),
			StringUtils.PATTERN_DATE_UI);
	    }
	    itemBeans.add(new EditMerchantProfileTableItemBean(messageBAO
		    .getMessage("com.fw.ui.view.profile.EditCashServiceProfileView.label.launchedDate"), DataUtils.stringValue(oldValue),
		    DataUtils.stringValue(newValue)));
	}
	if (DataUtils.isChange(oldServiceProfileBean.getIsNotifyCustomer(), serviceProfileBean.getIsNotifyCustomer())) {
	    itemBeans.add(new EditMerchantProfileTableItemBean(messageBAO
		    .getMessage("com.fw.ui.view.profile.EditCashServiceProfileView.label.isNotifyCustomer"), DataUtils
		    .stringValue(oldServiceProfileBean.getIsNotifyCustomer()), DataUtils.stringValue(serviceProfileBean
		    .getIsNotifyCustomer())));
	}
	if (DataUtils.isChange(oldServiceProfileBean.getIsResponseUrlBack(), serviceProfileBean.getIsResponseUrlBack())) {
	    itemBeans.add(new EditMerchantProfileTableItemBean(messageBAO
		    .getMessage("com.fw.ui.view.profile.EditCashServiceProfileView.label.responseUrlBack"), DataUtils
		    .stringValue(oldServiceProfileBean.getIsResponseUrlBack()), DataUtils.stringValue(serviceProfileBean
		    .getIsResponseUrlBack())));
	}
	if (DataUtils.isChange(oldServiceProfileBean.getResponseUrlBack(), serviceProfileBean.getResponseUrlBack())) {
	    itemBeans.add(new EditMerchantProfileTableItemBean(messageBAO
		    .getMessage("com.fw.ui.view.profile.EditCashServiceProfileView.label.responseUrlBack"), DataUtils
		    .stringValue(oldServiceProfileBean.getResponseUrlBack()),
		    DataUtils.stringValue(serviceProfileBean.getResponseUrlBack())));
	}
	if (DataUtils.isChange(oldServiceProfileBean.getIsSuccessUrl(), serviceProfileBean.getIsSuccessUrl())) {
	    itemBeans.add(new EditMerchantProfileTableItemBean(messageBAO
		    .getMessage("com.fw.ui.view.profile.EditCashServiceProfileView.label.successUrl"), DataUtils
		    .stringValue(oldServiceProfileBean.getIsSuccessUrl()), DataUtils.stringValue(serviceProfileBean.getIsSuccessUrl())));
	}
	if (DataUtils.isChange(oldServiceProfileBean.getSuccessUrl(), serviceProfileBean.getSuccessUrl())) {
	    itemBeans.add(new EditMerchantProfileTableItemBean(messageBAO
		    .getMessage("com.fw.ui.view.profile.EditCashServiceProfileView.label.successUrl"), DataUtils
		    .stringValue(oldServiceProfileBean.getSuccessUrl()), DataUtils.stringValue(serviceProfileBean.getSuccessUrl())));
	}
	if (DataUtils.isChange(oldServiceProfileBean.getIsFailUrl(), serviceProfileBean.getIsFailUrl())) {
	    itemBeans.add(new EditMerchantProfileTableItemBean(messageBAO
		    .getMessage("com.fw.ui.view.profile.EditCashServiceProfileView.label.failUrl"), DataUtils
		    .stringValue(oldServiceProfileBean.getIsFailUrl()), DataUtils.stringValue(serviceProfileBean.getIsFailUrl())));
	}
	if (DataUtils.isChange(oldServiceProfileBean.getFailUrl(), serviceProfileBean.getFailUrl())) {
	    itemBeans.add(new EditMerchantProfileTableItemBean(messageBAO
		    .getMessage("com.fw.ui.view.profile.EditCashServiceProfileView.label.failUrl"), DataUtils
		    .stringValue(oldServiceProfileBean.getFailUrl()), DataUtils.stringValue(serviceProfileBean.getFailUrl())));
	}
	if (DataUtils.isChange(oldServiceProfileBean.getIsCancelUrl(), serviceProfileBean.getIsCancelUrl())) {
	    itemBeans.add(new EditMerchantProfileTableItemBean(messageBAO
		    .getMessage("com.fw.ui.view.profile.EditCashServiceProfileView.label.cancelUrl"), DataUtils
		    .stringValue(oldServiceProfileBean.getIsCancelUrl()), DataUtils.stringValue(serviceProfileBean.getIsCancelUrl())));
	}
	if (DataUtils.isChange(oldServiceProfileBean.getCancelUrl(), serviceProfileBean.getCancelUrl())) {
	    itemBeans.add(new EditMerchantProfileTableItemBean(messageBAO
		    .getMessage("com.fw.ui.view.profile.EditCashServiceProfileView.label.cancelUrl"), DataUtils
		    .stringValue(oldServiceProfileBean.getCancelUrl()), DataUtils.stringValue(serviceProfileBean.getCancelUrl())));
	}
	if (DataUtils.isChange(oldServiceProfileBean.getInvoiceAging(), serviceProfileBean.getInvoiceAging())) {
	    itemBeans.add(new EditMerchantProfileTableItemBean(messageBAO
		    .getMessage("com.fw.ui.view.profile.EditCashServiceProfileView.label.invoiceAging"), DataUtils
		    .stringValue(oldServiceProfileBean.getInvoiceAging()), DataUtils.stringValue(serviceProfileBean.getInvoiceAging())));
	}
	if (DataUtils.isChange(oldServiceProfileBean.getIsBypassInvoiceAging(), serviceProfileBean.getIsBypassInvoiceAging())) {
	    itemBeans.add(new EditMerchantProfileTableItemBean(messageBAO
		    .getMessage("com.fw.ui.view.profile.EditCashServiceProfileView.label.isBypassInvoiceAging"), DataUtils
		    .stringValue(oldServiceProfileBean.getIsBypassInvoiceAging()), DataUtils.stringValue(serviceProfileBean
		    .getIsBypassInvoiceAging())));
	}
	if (DataUtils.isChange(oldServiceProfileBean.getBankCodeAndName(), serviceProfileBean.getBankCodeAndName())) {
	    String oldValue = editCashServiceProfileView.getCbbBankCodeAndName().getItemCaption(oldServiceProfileBean.getBankCodeAndName());
	    String newValue = editCashServiceProfileView.getCbbBankCodeAndName().getItemCaption(serviceProfileBean.getBankCodeAndName());
	    itemBeans.add(new EditMerchantProfileTableItemBean(messageBAO
		    .getMessage("com.fw.ui.view.profile.EditCashServiceProfileView.label.bankCodeAndName"),
		    DataUtils.stringValue(oldValue), DataUtils.stringValue(newValue)));
	}
	if (DataUtils.isChange(oldServiceProfileBean.getSapArCode(), serviceProfileBean.getSapArCode())) {
	    itemBeans.add(new EditMerchantProfileTableItemBean(messageBAO
		    .getMessage("com.fw.ui.view.profile.EditCashServiceProfileView.label.sapArCode"), DataUtils
		    .stringValue(oldServiceProfileBean.getSapArCode()), DataUtils.stringValue(serviceProfileBean.getSapArCode())));
	}
	if (DataUtils.isChange(oldServiceProfileBean.getSapApCode(), serviceProfileBean.getSapApCode())) {
	    itemBeans.add(new EditMerchantProfileTableItemBean(messageBAO
		    .getMessage("com.fw.ui.view.profile.EditCashServiceProfileView.label.sapApCode"), DataUtils
		    .stringValue(oldServiceProfileBean.getSapApCode()), DataUtils.stringValue(serviceProfileBean.getSapApCode())));
	}
	if (DataUtils.isChange(oldServiceProfileBean.getMessageSlip1(), serviceProfileBean.getMessageSlip1())) {
	    itemBeans.add(new EditMerchantProfileTableItemBean(messageBAO
		    .getMessage("com.fw.ui.view.profile.EditCashServiceProfileView.label.messageSlip1"), DataUtils
		    .stringValue(oldServiceProfileBean.getMessageSlip1()), DataUtils.stringValue(serviceProfileBean.getMessageSlip1())));
	}
	if (DataUtils.isChange(oldServiceProfileBean.getMessageSlip2(), serviceProfileBean.getMessageSlip2())) {
	    itemBeans.add(new EditMerchantProfileTableItemBean(messageBAO
		    .getMessage("com.fw.ui.view.profile.EditCashServiceProfileView.label.messageSlip2"), DataUtils
		    .stringValue(oldServiceProfileBean.getMessageSlip2()), DataUtils.stringValue(serviceProfileBean.getMessageSlip2())));
	}
	if (DataUtils.isChange(oldServiceProfileBean.getMdr(), serviceProfileBean.getMdr())) {
	    itemBeans.add(new EditMerchantProfileTableItemBean(messageBAO
		    .getMessage("com.fw.ui.view.profile.EditCashServiceProfileView.label.mdr"), DataUtils.stringValue(oldServiceProfileBean
		    .getMdr()), DataUtils.stringValue(serviceProfileBean.getMdr())));
	}
	if (DataUtils.isChange(oldServiceProfileBean.getServiceFee(), serviceProfileBean.getServiceFee())) {
	    itemBeans.add(new EditMerchantProfileTableItemBean(messageBAO
		    .getMessage("com.fw.ui.view.profile.EditCashServiceProfileView.label.serviceFee"), DataUtils
		    .stringValue(oldServiceProfileBean.getServiceFee()), DataUtils.stringValue(serviceProfileBean.getServiceFee())));
	}
	if (DataUtils.isChange(oldServiceProfileBean.getDailyLimit(), serviceProfileBean.getDailyLimit())) {
	    itemBeans.add(new EditMerchantProfileTableItemBean(messageBAO
		    .getMessage("com.fw.ui.view.profile.EditCashServiceProfileView.label.dailyLimit"), DataUtils
		    .stringValue(oldServiceProfileBean.getDailyLimit()), DataUtils.stringValue(serviceProfileBean.getDailyLimit())));
	}
	if (DataUtils.isChange(oldServiceProfileBean.getMonthlyLimit(), serviceProfileBean.getMonthlyLimit())) {
	    itemBeans.add(new EditMerchantProfileTableItemBean(messageBAO
		    .getMessage("com.fw.ui.view.profile.EditCashServiceProfileView.label.monthlyLimit"), DataUtils
		    .stringValue(oldServiceProfileBean.getMonthlyLimit()), DataUtils.stringValue(serviceProfileBean.getMonthlyLimit())));
	}
	if (DataUtils.isChange(oldServiceProfileBean.getTransactionAmountLimit(), serviceProfileBean.getTransactionAmountLimit())) {
	    itemBeans.add(new EditMerchantProfileTableItemBean(messageBAO
		    .getMessage("com.fw.ui.view.profile.EditCashServiceProfileView.label.transactionAmountLimit"), DataUtils
		    .stringValue(oldServiceProfileBean.getTransactionAmountLimit()), DataUtils.stringValue(serviceProfileBean
		    .getTransactionAmountLimit())));
	}

	String prefix = messageBAO.getMessage("com.fw.ui.view.profile.EditCashServiceProfileView.label.contact.project.text") + " ";
	String name = messageBAO.getMessage("com.fw.ui.view.profile.EditCashServiceProfileView.label.contact.name");
	String phone = messageBAO.getMessage("com.fw.ui.view.profile.EditCashServiceProfileView.label.contact.phone");
	String mobile = messageBAO.getMessage("com.fw.ui.view.profile.EditCashServiceProfileView.label.contact.mobile");
	String email = messageBAO.getMessage("com.fw.ui.view.profile.EditCashServiceProfileView.label.contact.email");
	if (DataUtils.isChange(oldServiceProfileBean.getContact1Name(), serviceProfileBean.getContact1Name())) {
	    itemBeans.add(new EditMerchantProfileTableItemBean(prefix + name,
		    DataUtils.stringValue(oldServiceProfileBean.getContact1Name()), DataUtils.stringValue(serviceProfileBean
			    .getContact1Name())));
	}
	if (DataUtils.isChange(oldServiceProfileBean.getContact1Phone(), serviceProfileBean.getContact1Phone())) {
	    itemBeans.add(new EditMerchantProfileTableItemBean(prefix + phone, DataUtils.stringValue(oldServiceProfileBean
		    .getContact1Phone()), DataUtils.stringValue(serviceProfileBean.getContact1Phone())));
	}
	if (DataUtils.isChange(oldServiceProfileBean.getContact1Mobile(), serviceProfileBean.getContact1Mobile())) {
	    itemBeans.add(new EditMerchantProfileTableItemBean(prefix + mobile, DataUtils.stringValue(oldServiceProfileBean
		    .getContact1Mobile()), DataUtils.stringValue(serviceProfileBean.getContact1Mobile())));
	}
	if (DataUtils.isChange(oldServiceProfileBean.getContact1Email(), serviceProfileBean.getContact1Email())) {
	    itemBeans.add(new EditMerchantProfileTableItemBean(prefix + email, DataUtils.stringValue(oldServiceProfileBean
		    .getContact1Email()), DataUtils.stringValue(serviceProfileBean.getContact1Email())));
	}
	// contact2
	prefix = messageBAO.getMessage("com.fw.ui.view.profile.EditCashServiceProfileView.label.contact.operation.text") + " ";
	if (DataUtils.isChange(oldServiceProfileBean.getContact2Name(), serviceProfileBean.getContact2Name())) {
	    itemBeans.add(new EditMerchantProfileTableItemBean(prefix + name,
		    DataUtils.stringValue(oldServiceProfileBean.getContact2Name()), DataUtils.stringValue(serviceProfileBean
			    .getContact2Name())));
	}
	if (DataUtils.isChange(oldServiceProfileBean.getContact2Phone(), serviceProfileBean.getContact2Phone())) {
	    itemBeans.add(new EditMerchantProfileTableItemBean(prefix + phone, DataUtils.stringValue(oldServiceProfileBean
		    .getContact2Phone()), DataUtils.stringValue(serviceProfileBean.getContact2Phone())));
	}
	if (DataUtils.isChange(oldServiceProfileBean.getContact2Mobile(), serviceProfileBean.getContact2Mobile())) {
	    itemBeans.add(new EditMerchantProfileTableItemBean(prefix + mobile, DataUtils.stringValue(oldServiceProfileBean
		    .getContact2Mobile()), DataUtils.stringValue(serviceProfileBean.getContact2Mobile())));
	}
	if (DataUtils.isChange(oldServiceProfileBean.getContact2Email(), serviceProfileBean.getContact2Email())) {
	    itemBeans.add(new EditMerchantProfileTableItemBean(prefix + email, DataUtils.stringValue(oldServiceProfileBean
		    .getContact2Email()), DataUtils.stringValue(serviceProfileBean.getContact2Email())));
	}
	// contact3
	prefix = messageBAO.getMessage("com.fw.ui.view.profile.EditCashServiceProfileView.label.contact.technical.text") + " ";
	if (DataUtils.isChange(oldServiceProfileBean.getContact3Name(), serviceProfileBean.getContact3Name())) {
	    itemBeans.add(new EditMerchantProfileTableItemBean(prefix + name,
		    DataUtils.stringValue(oldServiceProfileBean.getContact3Name()), DataUtils.stringValue(serviceProfileBean
			    .getContact3Name())));
	}
	if (DataUtils.isChange(oldServiceProfileBean.getContact3Phone(), serviceProfileBean.getContact3Phone())) {
	    itemBeans.add(new EditMerchantProfileTableItemBean(prefix + phone, DataUtils.stringValue(oldServiceProfileBean
		    .getContact3Phone()), DataUtils.stringValue(serviceProfileBean.getContact3Phone())));
	}
	if (DataUtils.isChange(oldServiceProfileBean.getContact3Mobile(), serviceProfileBean.getContact3Mobile())) {
	    itemBeans.add(new EditMerchantProfileTableItemBean(prefix + mobile, DataUtils.stringValue(oldServiceProfileBean
		    .getContact3Mobile()), DataUtils.stringValue(serviceProfileBean.getContact3Mobile())));
	}
	if (DataUtils.isChange(oldServiceProfileBean.getContact3Email(), serviceProfileBean.getContact3Email())) {
	    itemBeans.add(new EditMerchantProfileTableItemBean(prefix + email, DataUtils.stringValue(oldServiceProfileBean
		    .getContact3Email()), DataUtils.stringValue(serviceProfileBean.getContact3Email())));
	}
	// contact4
	prefix = messageBAO.getMessage("com.fw.ui.view.profile.EditCashServiceProfileView.label.contact.financial.text") + " ";
	if (DataUtils.isChange(oldServiceProfileBean.getContact4Name(), serviceProfileBean.getContact4Name())) {
	    itemBeans.add(new EditMerchantProfileTableItemBean(prefix + name,
		    DataUtils.stringValue(oldServiceProfileBean.getContact4Name()), DataUtils.stringValue(serviceProfileBean
			    .getContact4Name())));
	}
	if (DataUtils.isChange(oldServiceProfileBean.getContact4Phone(), serviceProfileBean.getContact4Phone())) {
	    itemBeans.add(new EditMerchantProfileTableItemBean(prefix + phone, DataUtils.stringValue(oldServiceProfileBean
		    .getContact4Phone()), DataUtils.stringValue(serviceProfileBean.getContact4Phone())));
	}
	if (DataUtils.isChange(oldServiceProfileBean.getContact4Mobile(), serviceProfileBean.getContact4Mobile())) {
	    itemBeans.add(new EditMerchantProfileTableItemBean(prefix + mobile, DataUtils.stringValue(oldServiceProfileBean
		    .getContact4Mobile()), DataUtils.stringValue(serviceProfileBean.getContact4Mobile())));
	}
	if (DataUtils.isChange(oldServiceProfileBean.getContact4Email(), serviceProfileBean.getContact4Email())) {
	    itemBeans.add(new EditMerchantProfileTableItemBean(prefix + email, DataUtils.stringValue(oldServiceProfileBean
		    .getContact4Email()), DataUtils.stringValue(serviceProfileBean.getContact4Email())));
	}

	// create beanItems
	if (itemBeans != null && !itemBeans.isEmpty()) {
	    for (EditMerchantProfileTableItemBean editMerchantProfileTableItemBean : itemBeans) {
		beanItems.add(new BeanItem<EditMerchantProfileTableItemBean>(editMerchantProfileTableItemBean));
	    }
	}
	return beanItems;
    }
}
